﻿namespace LearnDSLinearSearch;

public class LinearSearch
{
    public int Search(int[] array, int n, int key)
    {
        int index = 0;
        while (index < n)
        {
            if (array[index] == key)
                return index;
            index++;
        }

        return -1;
    }
}